package com.rds.system.service.impl;

import com.rds.common.utils.uuid.SnowFlakeUtils;
import com.rds.system.domain.SysHistory;
import com.rds.system.mapper.SysHistoryMapper;
import com.rds.system.service.ISysHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 历史记录-->Service 实现类
 * @version : 1.0
 * @Copyright: Copyright(c) 2020-2021 All right reserved
 * @Company: GUANGZHOU RDS Co.,LTD
 * @author: LiChuanlong
 * @create Date : 2021/12/13 : 22:39
 */
@Service
public class SysHistoryService implements ISysHistoryService {
    @Autowired
    private SysHistoryMapper sysHistoryMapper;

    @Override
    public int insertHistory(SysHistory sysHistory) {
        /*使用雪花算法实现Id**/
        sysHistory.setId(SnowFlakeUtils.nextId());
        return sysHistoryMapper.insertHistory(sysHistory);
    }

    @Override
    public int deleteHistoryById(Long id) {
        return sysHistoryMapper.deleteHistoryById(id);
    }

    @Override
    public int deleteHistoryByArrays(Long[] ids) {
        return sysHistoryMapper.deleteHistoryByArrays(ids);
    }

    @Override
    public SysHistory selectHistoryById(Long id) {
        return sysHistoryMapper.selectHistoryById(id);
    }

    @Override
    public List<SysHistory> findHistorys(SysHistory sysHistory) {
        return sysHistoryMapper.findHistorys(sysHistory);
    }

    @Override
    public List<SysHistory> selectHistoryByScope(Integer scope) {
        return sysHistoryMapper.selectHistoryByScope(scope);
    }
}
